package com.frain.springcloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

@Controller
@RequestMapping("/customer")
public class DemoCustomerController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/findProvider")
    @ResponseBody
    public String getProvider() {

        String providerMsg = restTemplate.getForEntity("http://127.0.0.1:10020/demo/getFind", String.class).getBody();
        System.out.println(providerMsg);
        return "Hello World";
    }

    @RequestMapping("/demo")
    @ResponseBody
    public String getGitHubConfig() {
        String providerMsg = restTemplate.getForEntity("http://127.0.0.1:10020/demo/home", String.class).getBody();
        System.out.println(providerMsg);
        return providerMsg;
    }

}
